import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Home from '@/home'
//顶部导航栏
import Workbench from '@/views/workbench.vue'
import Evaluation from '@/views/evaluation.vue'
import Service from '@/views/service.vue'
import Settlement from '@/views/settlement.vue'
import Knowledge from '@/views/knowledge.vue'

//workbench侧边导航栏
import Index from '@/views/workbench/index.vue'
import Order from '@/views/workbench/order.vue'
import Company from '@/views/workbench/company.vue'
import Calendar from '@/views/workbench/calendar.vue'
import Prevent from '@/views/workbench/prevent.vue'

// Calendar引入文件
import CalendarService from '@/views/workbench/tab/calendarService.vue'
import ServiceSpan from '@/views/workbench/tab/calendarSpan.vue'

//工作台的十个导航
import Tab0 from '@/views/Workbench/tab/tab0.vue'
import Tab1 from '@/views/Workbench/tab/tab1.vue'
import Tab2 from '@/views/Workbench/tab/tab2.vue'
import Tab3 from '@/views/Workbench/tab/tab3.vue'
import Tab4 from '@/views/Workbench/tab/tab4.vue'
import Tab5 from '@/views/Workbench/tab/tab5.vue'
import Tab6 from '@/views/Workbench/tab/tab6.vue'
import Tab7 from '@/views/Workbench/tab/tab7.vue'
import Tab8 from '@/views/Workbench/tab/tab8.vue'
import Tab9 from '@/views/Workbench/tab/tab9.vue'

//单位管理子路由
import User_information from '@/views/workbench/tab/user_information'
import Unit_management from '@/views/workbench/tab/unit_management'

//服务成效六个侧边栏
import Hidden_danger from '@/views/service/Hidden_danger'
import Risk from '@/views/service/Risk'
import Education_training from '@/views/service/Education_training'
import Emergency from '@/views/service/Emergency'
import Standard from '@/views/service/Standard'
import Other from '@/views/service/Other'

//服务成效隐患管理子路由
import Service_tab0 from '@/views/service/tab/tab0.vue'
import Service_tab1 from '@/views/service/tab/tab1.vue'
import Service_tab2 from '@/views/service/tab/tab2.vue'
import Service_tab3 from '@/views/service/tab/tab3.vue'
import Service_tab4 from '@/views/service/tab/tab4.vue'


Vue.use(Router)

// 获取原型对象上的push函数
const originalPush = Router.prototype.push
// 修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/Workbench"
    },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/Workbench',
          name: "Workbench",
          component: Workbench,
          children: [
            {
              path: 'Index',
              name: 'Index',
              component: Index,
              children: [
                {
                  path: '0',
                  name: "Tab0",
                  component: Tab0,
                },
                {
                  path: '1',
                  name: "Tab1",
                  component: Tab1,
                },
                {
                  path: '2',
                  name: "Tab2",
                  component: Tab2,
                },
                {
                  path: '3',
                  name: "Tab3",
                  component: Tab3,
                },
                {
                  path: '4',
                  name: "Tab4",
                  component: Tab4,
                },
                {
                  path: '5',
                  name: "Tab5",
                  component: Tab5,
                },
                {
                  path: '6',
                  name: "Tab6",
                  component: Tab6,
                },
                {
                  path: '7',
                  name: "Tab7",
                  component: Tab7,
                },
                {
                  path: '8',
                  name: "Tab8",
                  component: Tab8,
                },
                {
                  path: '9',
                  name: "Tab9",
                  component: Tab9,
                },

              ]
            }, {
              path: 'Order',
              name: 'Order',
              component: Order,
            }
            , {
              path: 'Calendar',
              name: 'Calendar',
              component: Calendar,
              children: [
                {
                  path: '0',
                  name: 'ServiceSpan',
                  component: ServiceSpan,
                },
                {
                  path: '1',
                  name: 'CalendarService',
                  component: CalendarService,
                }
              ]
            }
            , {
              path: 'Prevent',
              name: 'Prevent',
              component: Prevent,
            }, {
              path: 'Company',
              name: 'Company',
              component: Company,
              children: [
                {
                  path: '0',
                  name: 'unit_management',
                  component: Unit_management,
                },
                {
                  path: '1',
                  name: 'user_information',
                  component: User_information,
                }
              ]
            }

          ]
        }, {
          path: '/Evaluation',
          name: "Evaluation",
          component: Evaluation,
        }
        , {
          path: '/Service',
          name: "Service",
          component: Service,
          children: [
            {
              path: 'Hidden_danger',
              name: 'Hidden_danger',
              component: Hidden_danger,
              children: [
                {
                  path: '0',
                  name: 'Service_tab0',
                  component: Service_tab0,
                }, {
                  path: '1',
                  name: 'Service_tab1',
                  component: Service_tab1,
                }, {
                  path: '2',
                  name: 'Service_tab2',
                  component: Service_tab2,
                }, {
                  path: '3',
                  name: 'Service_tab3',
                  component: Service_tab3,
                }, {
                  path: '4',
                  name: 'Service_tab4',
                  component: Service_tab4,
                },
              ]
            },
            {
              path: 'Risk',
              name: 'Risk',
              component: Risk,
            },
            {
              path: 'Education_training',
              name: 'Education_training',
              component: Education_training,
            },
            {
              path: 'Emergency',
              name: 'Emergency',
              component: Emergency,
            },
            {
              path: 'Standard',
              name: 'Standard',
              component: Standard,
            },
            {
              path: 'Other',
              name: 'Other',
              component: Other,
            },
          ]


        }
        , {
          path: '/Settlement',
          name: "Settlement",
          component: Settlement,
        }
        , {
          path: '/Knowledge',
          name: "Knowledge",
          component: Knowledge,
        }
      ]
    },
  ]
})
